/**
 * @(#) ApplicationFacade.as
 *
 * @date		2009. 06. 24.
 * @version		1.0
 * @author		Shin, Yunwoo
 * @description	Application Facade - key : eHrMain
 * 				mvc간 주고 받는 메세지를 정의하고,  command를 등록한다. 
 */
package com.skt.common_hr.main
{
	import com.skt.common_hr.common.puremvc.CommonFacade;
	import com.skt.common_hr.main.controller.StartupCommand;
	
	import flash.display.DisplayObject;
	
	public class ApplicationFacade extends CommonFacade
	{
        public static const STARTUP:String          				= "startup";		
		public static const SELECTED_MENU:String					= "selectedMenu";
		public static const LOGOUT:String							= "logout";
		
		public static const LOAD_PROFILE_COMPLETE:String			= "loadProfileComplete";
		public static const LOAD_PROFILE_FAILED:String				= "loadProfileFailed";
		
		public static const LOAD_NOTICE_MAINLIST_COMPLETE:String	= "LoadNoticeAainlistComplete";
		public static const LOAD_NOTICE_MAINLIST_FAILED:String		= "LoadNoticeMainlistFailed";
		public static const LOAD_NOTICE_VIEWLIST_COMPLETE:String	= "LoadNoticeViewlistComplete";
		public static const LOAD_NOTICE_VIEWLIST_FAILED:String		= "LoadNoticeViewlistFailed";
		public static const UPDATE_COUNT_COMPLETE:String			= "updateCountComplete";
		public static const UPDATE_COUNT_FAILED:String				= "updateCountFailed";
		
		public static const LOAD_ANNIVER_LIST_COMPLETE:String		= "LoadAnniverListComplete";
		public static const LOAD_ANNIVER_LIST_FAILED:String			= "LoadAnniverListFailed";
		public static const LOAD_VIEW_ANNIVER_LIST_COMPLETE:String	= "LoadWiewAnniverListComplete";
		public static const LOAD_VIEW_ANNIVER_LIST_FAILED:String	= "LoadViewAnniverListFailed";
		public function ApplicationFacade( key:String, lock:SingletonLock )
		{
			super(key);	
		}
		
        /**
         * Singleton ApplicationFacade Factory Method
         */
        public static function getInstance( key:String ) : ApplicationFacade 
        {
            if ( instanceMap[ key ] == null ) instanceMap[ key ] = new ApplicationFacade( key, new SingletonLock );
            return instanceMap[ key ] as ApplicationFacade;
        }


        /**
         * Register Commands with the Controller 
         */
        override protected function initializeController( ) : void {
            super.initializeController();            
            registerCommand( STARTUP, StartupCommand);
        }
       
		/**
		 * START_UP Noti를 발생시킨다.
		 *                   - 어플리케이션의 시작점?!
		 * @param
		 * @return void
		 */
		public function startup(app:Object) :void {
			trace("facade.startup");
			this.app = app as DisplayObject;
            sendNotification( STARTUP, app );
        }
        
	}
}

internal class SingletonLock
{
}
	
